import React, { memo, Component } from 'react'
// import { } from '@/api/user'
import { Spin, Alert } from 'antd'
import './index.css'
import {baseUrl} from '../../../assets/baseUrl'
const baseurl = baseUrl()
// import { NotificationOutlined } from '@ant-design/icons';
class ConfessionCard extends Component {
    constructor(props) {
        super(props);
        this.state = {
          data:props.data
        }
    }
    componentDidMount() {
      
    }

    gotoDetail =(item) =>{
      this.props.history.push('/home/schoolIndex/confession/confessionDetail?id='+item.id)
    }
    render() {
        const { data } = this.state
        return (
            <div className='confessionCard' onClick={()=>this.gotoDetail(data)}>
              {data.files.split('&').length >0 &&<div className='confessionCard-img' style={{
                background:`url('${baseurl}/${data.files.split('&')[0]}') no-repeat center center`,
                backgroundSize:'contain'
              }}></div>}
              <div className='confessionCard-text-box'>
                <div className="title">{data.title}</div>
                <div className={data.view > 3000 ? "view-fire" : "view"}>{data.browseCount}</div>
              </div>
            </div>
        )
    }
}
export default memo(ConfessionCard)